package IO.stream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class TestOutput {
    public static void main(String[] args) {

        try(OutputStream outputStream = new FileOutputStream("d:/test.txt")){
            // 每次按照写的方式打开原文件,会清空文件内容
            // 不过有追加的方式
//            outputStream.write(123);
//            outputStream.write(43);

            byte[] buffer = new byte[]{123,43,43,65};
            outputStream.write(buffer);

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
